#!/usr/bin/env pyahont3

"""
练习作业：04
4. 计算打印 杨辉三角 传入参数 L 为打印的层数； [使用函数递归调用]
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
"""
def z(x,y):
    if y==0 or x==y:
        return 1
    return z(x-1,y-1)+z(x-1,y)
L=int(input("层数"))
for x in range(0,L):
    for y in range(0,x):
        print(z(x,y),end="  ")
    print("1")






#L=10

#L=10
#n=1  #行数
#while n<=L:
#    pass

#a:行数
#b:列数
#返回对应行列值

"""def yang(a,b):
    a=int(input("行数"))
    b=0
    c=a+b
    print(a,c,a)

yang()"""
#input:x,y
#return:杨辉三角在第x行、第y列的值 x,y基于1
# 1
# 1,1
# 1,2,1
# 1,3,3,1
# 1,4,6,4,1
# 1,5,10,10,5,1
# 1,6,15,20,15,6,1
# 1,7,21,35,35,21,7,1
# 1,8,28,56,70,56,28,8,1
# 1,9,36,84,126,126,84,36,9,1
"""
def san(a):
    a=int(input("?"))
    a=a+1
    b="*"
    for i in range(2,a,1):
        print((b*i).center(i))
print("a",end="")
print("b",end="")
print()
def z(x,y):
    if x==1:
        return 1
    if y==x:
        return 1
    return z(x-1,y-1)+z(x-1,y)
    print(z)
for x in range(1,10):
    for y in range(1,x):
        def z(x,y):
            if x==1:
                return 1
            if y==x:
                return 1
            return z(x-1,y-1)+z(x-1,y)
        if y<x:
            print(z(x,y),end="")
        if y==x:
            print("")
def z(x,y):
    if y==1:
        return 1
    if y>=x:
        return 0
    return z(x-1,y-1)+z(x-1,y)
for x in range(1,5):
    for y in range(1,5):
        print(z(x,y))
        def main():
if __name__ ==  "__main__":
    a=int(input("?"))
    main()
    san(10)
def z(x,y):
    if x==1 and y==1:
        s=1
    if x!=1 and y!=1:
for x in range(1,10):
    for y in range(1,10):
        def z(x,y):
            if y==1:
                return 1
            if y>=x:
                return 0
            return z(x-1,y-1)+z(x-1,y)
            print(z(x,y))
        z(x,y)
def z(n):
    a=[1]
    if n==0:
        return a
    return [x+y for x, y in zip([0]+z(n-1),z(n-1)+[0])]
for i in range(9):
    print(z(i))
def z(x,y):
    a=[1]
    if x==0:
        return a
    return [z(x-1,y-1)+z(x-1,y)]
for x in range(1,5):
    for y in range(1,x):
        print(z(x,y))
def z(x,y):
    if y==1:
        return 1
    if y>x:
        return 1
    return (z(x-1,y-1)+z(x-1,y))
    print(z(x,y))
for x in range(1,10):
    for y in range(1,10):
        z(x,y)
def z(x,y):
    a=[1]
    if x==1:
        return a
    return (x+y for x,y in zip(z(x-1,y-1)+z(x-1,y)))
for x in range(0,5):
    for y in range(0,x):
        print(z(x,y))


L=int(input("?"))
for x in range(0,L):
    for y in range(0,x):
        def z(x,y):
            if y==0 or x==y:
                return 1
            return z(x-1,y-1)+z(x-1,y)
        print(z(x,y),end=" ")
    print("1")"""
#!/usr/bin/env pyahont3

"""
练习作业：03
3. 计算 1+2+3...+100；并打印每一步的结果，例如：1+2=3；1+2+3=6；...; [使用函数]


N=100
a=1
b=0

while a<=N:
    b=b+a
    a=a+1
    c=a=+b
    if a<=N:
        print(f"{b}+{a}={b+a}")
print(b)
    if y==0 or x==y:
        return 1
    return z(x-1,y-1)+z(x-1,y)


def z(b,c):
    d=[]
    e=b
    f=1
    while e>1:
        d.append(f)
        e-=f
        f+=1
    for i in range(1,c+1)
    print


n=101
a=1
b=0
for c in range(a,n):
    b+=c
    print(f"{b}+{c}={b+c}")
"""
